-
Notifications
You must be signed in to change notification settings - Fork 7
change plugin coupling protocol for tests #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…environment variable - as config files are not parsed in most test cases
prepare to clean up filepath mess
Fetch directories
allow for file/dir deletion in test mode
also return full filepath when in filesystem mode
test if fileobject exists prior to delete attempt
after calling a plugin function, push files of artifacts to qiita cen…
add an interception to automatically fetch files from qiita central
Contributor
Author
|
Closing in favor of #60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @antgonza ,
I just realized that plugin tests behave slightly different than I expected:
PluginTestCaseclass of the qiita_client also checks the environment variableQIITA_PLUGINCOUPLING. Thus, by setting this env, tests will enable different protocols even though they don't adhere to the value in the generated plugin configuration file. (This PR)/apitest/reset/endpoint (and also others). However, this only works properly if qiita master is addressed. Tests therefore do not speak against nginx (port 8383) but directly with the master instance (port 21174). However, when sending files, I relied on delivery through nginx. If requests go directly to master, the file content will be empty - and tests fail. With PR Tornado fetch file from central handler qiita#3483 the according endpoint checks if a request was made through nginx (and then uses it's fast mechanism to deliver the file) or directly to the tornado instance (which now can also send the file in a much slower fashion). Should be fast enough for testing.As we use qiita_client in qp-target-gene, which operates on old python2, we need to make the
makedirsfunction compatible. The argumentexist_okdid not exist in py2.I've also added the ability to deposit not only a single file, but - if user provides a directory - recurse through this directory and iteratively deposit all found files. This is needed e.g. for qp-target-gene artifacts: https://github.com/qiita-spots/qp-target-gene/blob/858436ee6d4a1fccd35faee0b156a12953b5774a/qp_target_gene/pick_otus.py#L124
Similarly, clients can now fetch directories. As I fear that misbehaving clients might trigger fetching the whole QIITA_BASE_DIR, I am limiting this to those directories that are "managed" by Qiita's DB as filetype directory.
I realized that https://github.com/qiita-spots/qtp-sequencing/blob/4a325e7a75ca989eea9d9029acd02be2384a601e/qtp_sequencing/validate.py#L81 is directly deleting files in QIITA_BASE_DIR. Therefore, I added an according function to qiita_client and qiita, but only delete the file when using "filesystem" protocol OR qiita is run in test mode as I am too skeptical about providing an API endpoint to delete arbitrary files.